package edu.uwm.capstone.diasmart.types;

import android.app.Activity;
import android.content.Intent;
import android.view.View;
import android.widget.TableRow;
import edu.uwm.capstone.diasmart.R;
import edu.uwm.capstone.diasmart.database.DatabaseHelper;
import edu.uwm.capstone.diasmart.database.Entry;

public class PulseType extends BaseType {

	public String getMeasurementUnit(EntryContext paramEntryContext) {
		return paramEntryContext.getContext().getString(R.string.bpm);
	}

	@Override
	public int getType() {
		return 6;
	}

	@Override
	public TableRow[] getUserInterface(Activity paramActivity) {
		return EditableEntryTypeHelper.getStandardUserInterface(paramActivity,
				this, R.id.edtPulseValue, R.id.sprPulseSubType);
	}

	@Override
	public boolean handleOnActivityResult(Activity paramActivity,
			int paramInt1, int paramInt2, Intent paramIntent) {
		return EditableEntryTypeHelper.handleOnActivityResult(paramActivity,
				getType(), R.id.sprPulseSubType, paramInt1, paramInt2,
				paramIntent);

	}

	@Override
	public long save(DatabaseHelper paramDatabaseHelper, Entry paramEntry,
			View paramView) {
		return EditableEntryTypeHelper
				.saveStandard(paramDatabaseHelper, this, paramEntry, paramView,
						R.id.edtPulseValue, R.id.sprPulseSubType);
	}

	@Override
	public int validate(View paramView) {
		return EditableEntryTypeHelper.validateStandard(this, paramView,
				R.id.edtPulseValue, R.id.sprPulseSubType);
	}

	@Override
	public int validate(EntryContext paramEntryContext, String paramString) {
		return EditableEntryTypeHelper.validateStandard(
				paramEntryContext.getContext(), paramString);
	}

	public String toString() {
		return "Pulse";
	}

}
